{extend name="layout/main" /}

{block name="header"}

{/block}

{block name="content"}
<link rel="stylesheet" href="https://cdn.staticfile.org/webuploader/0.1.5/webuploader.css">
<script type="text/javascript" src='https://cdn.staticfile.org/webuploader/0.1.5/webuploader.min.js'></script>
<script src="__PUBLIC__/admin/js/wangEditor.min.js"></script>

<section class="panel">
    {if isset($info)}
    <header class="panel-heading">
        <h4>编辑任务</h4>
    </header>
    <div class="panel-body" style="padding-bottom: 50px">
        <form class="form-horizontal" method="post" onsubmit="return false" role="form">

            <div class="form-group">
                <label class="col-sm-2 control-label">所需达到月流水</label>

                <div class="col-sm-5">
                    <input type="text" value="{$info->water}" name="water" class="form-control"
                           placeholder="请输入所需达到月流水">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">奖励福豆</label>

                <div class="col-sm-5">
                    <input type="text" value="{$info->fbb}" name="fbb" class="form-control"
                           placeholder="请输入奖励福豆">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">奖励福积分</label>

                <div class="col-sm-5">
                    <input type="text" value="{$info->fzf}" name="fzf" class="form-control"
                           placeholder="请输入奖励福积分">
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" data-url="{:url('saveTask',['id'=>$info->id])}"
                            onclick="main.ajaxPosts(this)" class="btn btn-primary">确定修改
                    </button>
                </div>
            </div>
        </form>
    </div>
    {else /}
    <header class="panel-heading">
        <h4>添加商品</h4>
    </header>
    <div class="panel-body" style="padding-bottom: 50px">
        <form class="form-horizontal" method="post" onsubmit="return false" role="form">
            <div class="form-group">
                <label class="col-sm-2 control-label">所需达到月流水</label>

                <div class="col-sm-5">
                    <input type="text" name="water" class="form-control"
                           placeholder="请输入所需达到月流水">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">奖励福豆</label>

                <div class="col-sm-5">
                    <input type="text" name="fbb" class="form-control"
                           placeholder="请输入奖励福豆">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">奖励福积分</label>

                <div class="col-sm-5">
                    <input type="text" name="fzf" class="form-control"
                           placeholder="请输入奖励福积分">
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" onclick="main.ajaxPosts(this)" data-url="{:url('saveTask')}"
                            class="btn btn-primary">提交
                    </button>
                </div>
            </div>
        </form>
    </div>
    {/if}
</section>
{/block}


{block name="footer"}
<script src="__PUBLIC__/admin/vendor/fuelux/radio.js"></script>
<script>
    var E = window.wangEditor;
    var editor = new E('#editor');
    var $content = $('#content');
    editor.customConfig.uploadFileName = 'image'
    editor.customConfig.uploadImgServer = "{:url('upload/uploadEditor')}";
    editor.customConfig.onchange = function (html) {
        // 监控变化，同步更新到 textarea
        $content.val(html)
    };
    editor.customConfig.menus = [
        'head',  // 标题
        'bold',  // 粗体
        'fontSize',  // 字号
        'fontName',  // 字体
        'foreColor',  // 文字颜色
        'backColor',  // 背景颜色
        'link',  // 插入链接
        'list',  // 列表
        'justify',  // 对齐方式
        'quote',  // 引用
        'image',  // 插入图片
    ]
    editor.create()

    $(function(){
        $(".w-e-text-container").css('height','600px')
    })

</script>

{/block}